package com.alinakipoglu.asprocedural
{
	import com.alinakipoglu.asprocedural.interfaces.IIDStack;
	
	public class IDStack implements IIDStack
	{
		private var m_stackSize		:uint;
		private var m_stackData		:Vector.<String>;
		
		public function IDStack(_size:uint)
		{
			m_stackSize		= _size;
			m_stackData		= new Vector.<String>(m_stackSize);
		}
		
		public function get stackSize():uint
		{
			return m_stackSize;
		}
		
		public function set stackSize(_value:uint):void
		{
			m_stackSize			= _value;
		}
		
		public function get stack():Vector.<String>
		{
			return m_stackData;
		}
		
		public function push(_value:String):void
		{
			if(m_stackData.length == m_stackSize)
			{
				m_stackData.shift();
			}
			
			m_stackData[m_stackData.length]	= _value;
		}
		
		public function clear():void
		{
			m_stackData.length	= 0;
		}
	}
}